package iorder

import ie.com.stamply.security.User

class Customer {

    String firstName
    String surname
    String email
    String phone
    String mobile
    String photoUrl
    String facebookUrl
    String twitterUrl
    Address address
    Date dob    
    Date lastUpdate = new Date()
    Date created = new Date()
    User user;
    boolean active = true
    
    static constraints = {
        //user lazy: false, fetch: 'join'
        //address lazy: false, fetch: 'join'
    }
    
	static mapping = {
                table "customer"
                version false
                id column: 'id_customer', generator: 'increment'                            
                user lazy: false
                address lazy: false
	}    

	def beforeInsert() {
              created = new Date()
              lastUpdate = new Date()
              active = true
        }


	def beforeUpdate() {
            lastUpdate = new Date()
	}    

}
